package com.fanxuankai.boot.apollo.openapi.autoconfigure;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author fanxuankai
 */
@ConfigurationProperties(prefix = ApolloOpenApiProperties.PREFIX)
public class ApolloOpenApiProperties {
    public static final String PREFIX = "fxk.apollo.openapi";
    public static final String PORTAL_URL = PREFIX + ".portal-url";
    public static final String TOKEN = PREFIX + ".token";

    private String portalUrl;
    private String token;
    private Integer connectTimeout;
    private Integer readTimeout;
    private String appId;
    private String env;
    private String clusterName;
    private String namespace;

    public String getPortalUrl() {
        return portalUrl;
    }

    public void setPortalUrl(String portalUrl) {
        this.portalUrl = portalUrl;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public Integer getConnectTimeout() {
        return connectTimeout;
    }

    public void setConnectTimeout(Integer connectTimeout) {
        this.connectTimeout = connectTimeout;
    }

    public Integer getReadTimeout() {
        return readTimeout;
    }

    public void setReadTimeout(Integer readTimeout) {
        this.readTimeout = readTimeout;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getEnv() {
        return env;
    }

    public void setEnv(String env) {
        this.env = env;
    }

    public String getClusterName() {
        return clusterName;
    }

    public void setClusterName(String clusterName) {
        this.clusterName = clusterName;
    }

    public String getNamespace() {
        return namespace;
    }

    public void setNamespace(String namespace) {
        this.namespace = namespace;
    }

    public static class Namespace {
        private String name;
        private String comment;
        private boolean publicNamespace;
        private Format format;
        private boolean appendNamespacePrefix = true;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getComment() {
            return comment;
        }

        public void setComment(String comment) {
            this.comment = comment;
        }

        public boolean isPublicNamespace() {
            return publicNamespace;
        }

        public void setPublicNamespace(boolean publicNamespace) {
            this.publicNamespace = publicNamespace;
        }

        public Format getFormat() {
            return format;
        }

        public void setFormat(Format format) {
            this.format = format;
        }

        public boolean isAppendNamespacePrefix() {
            return appendNamespacePrefix;
        }

        public void setAppendNamespacePrefix(boolean appendNamespacePrefix) {
            this.appendNamespacePrefix = appendNamespacePrefix;
        }

        public enum Format {
            PROPERTIES, XML, JSON, YML, YAML, TXT
        }
    }
}
